<template>
  <div id="mapContainer">
    <iframe style="width: 100%; height: 100%;" :src="mapUrl"></iframe>
  </div>
</template>

<script>
export default {
  data() {
    return {
      mapUrl: window.g.oneMapUrl
    }

  },
  methods: {
    init() {
      debugger
      let selectedData = this.form[0];
      let node, type, cityCode;
        if (selectedData.NODE_GUID == "{5E1AD806-7824-4196-8ADF-E231A8704FD3}" || selectedData.NODE_GUID == "{67241083-CA60-43FC-B1C1-1F4A2D133184}") {//现场踏勘
          node = "takan";
          type = "edit";
        } else {
          node = "takan";
          type = "view";
        }
      //  else if (selectedData.WF_GUID == "{612C9C60-8D18-4D23-BF32-E9D9D01BB0EA}") {//现场放样
      //   if (selectedData.NODE_GUID == "{646A4D45-00AC-4EA9-98AE-C5E704740BC1}") {//现场放样
      //     node = "fangyang";
      //     type = "edit";
      //   } else {
      //     node = "fangyang";
      //     type = "view";
      //   }
      // }
      // else if (selectedData.WF_GUID == "{460B4B5F-C3C2-4D4D-A702-17D4B4A3252F}") {//基槽验线
      //   if (selectedData.NODE_GUID == "{D9C76DDF-7A07-4F5F-A9F2-FD597C715481}") {//基槽验线
      //     node = "fangyang";
      //     type = "view";
      //   } else {
      //     node = "fangyang";
      //     type = "view";
      //   }
      // } else if (selectedData.WF_GUID == "{7F042B34-7091-4884-A5D6-A615AE55497D}") {//一层立模
      //   if (selectedData.NODE_GUID == "{BFF3BE52-75D4-4C53-B5E9-9144E35E7617}") {//一层立模
      //     node = "fangyang";
      //     type = "view";
      //   } else {
      //     node = "fangyang";
      //     type = "view";
      //   }
      // } else if (selectedData.WF_GUID == "{8FAD71FB-7756-4F0A-BEE8-4F6397B075A8}") {//竣工验收
      //   if (selectedData.NODE_GUID == "{41EE42C1-2F52-45C5-A05C-D2D3160DCE23}") {//竣工验收
      //     node = "yanshou";
      //     type = "edit";
      //   } else {
      //     node = "yanshou";
      //     type = "view";
      //   }
      // }
      cityCode = selectedData.TOWN;
      if(selectedData.LSH){
        var data = [{
        "JDID": "" + selectedData.NODE_GUID + "",
        "SQBH": "" + selectedData.LSH + "",
        "FWBH": "" + selectedData.FAMILYHOUSEID + "",
        "APPLICANT": "" + selectedData.HOUSEAPPLICANT + "",
        "ADDESS": ""+selectedData.ADDRESS+"",
      }]
      this.mapUrl = window.g.MapUrl + "?jieduan=" + node + "&data=" + encodeURIComponent(JSON.stringify(data)) + "&type=" + type + "&user=" + cityCode;
      }else{
        this.$message.error("关联编号不能为空!")
      }

    }
  },
  mounted() {
    this.form = JSON.parse(this.$route.query.data);
    this.init()
    if (ZWJSBridge) {
      ZWJSBridge.setTitle({
        "title": "地图"
      }).then(res => {
      }).catch(err => {
      })
    }
  },
}
</script>

<style lang="scss" scoped>
#mapContainer {
  width: 100vw;
  height: 100vh;
  overflow: auto;
  background: #ffffff;
}
</style>
